//
// Created by wze-zero on 2024/8/29 029.
//
#include <iostream>

using namespace std;

int main() {
    int num1, num2, num3, num4;
    cin >> num1 >> num2 >> num3 >> num4;
    cout << (num1 + num2 - num3) * num4 << endl;
    return 0;
}